{{indexmenu_n>3}}

====== Fork and Build (Linux) ======

===== Requirements =====

  * Register with GitHub and obtained a profile. This allows the setting up of repositories where your code can be published.
  * Git
  * CMake

===== Process =====

- Using GitHub and working from your main GitHub folder make a fork of DR_pi from [[https://github.com/Rasbats/DR_pi|https://github.com/Rasbats/DR_pi]]

- Using 'Terminal' clone the plugin onto your machine:

{{:opencpn:dev:oplaydo:clone.png?nolink&}}

{{:opencpn:dev:oplaydo:git_clone.png?nolink&}}

- Make the 'build' directory and cd to 'build':

{{:opencpn:dev:oplaydo:mkdir_build_cd.png?nolink&}}

- 'CMake' a 'CodeBlocks' project:

{{:opencpn:dev:oplaydo:cmake_codeblocks.png?nolink&}}

{{:opencpn:dev:oplaydo:build_files_for_codeblocks.png?nolink&}}

- To see what files have been made use 'Files' to navigate to 'learning/DR_pi/build'. The 'CodeBlocks' project is called 'DR_pi.cbp'.

{{:opencpn:dev:oplaydo:codeblocks_project.png?nolink&}}

- Start 'CodeBlocks' and 'Build' the project.

{{:opencpn:dev:oplaydo:cb_build.png?nolink&}}

- There are some warnings but no errors.

- This builds the plugin file 'libDR_pi.so' in the 'build' directory

{{:opencpn:dev:oplaydo:install_1.png?nolink&}}

- The .so file can be moved to the plugins folder 'usr/lib/opencpn' using 'Terminal'.

{{:opencpn:dev:oplaydo:install_2.png?nolink&}}

==== Alternative plugin installation using the Software Centre ====

- It may be easier to make a package and install this using the 'Ubuntu Software Centre'.

- From 'Terminal', in 'build', 'sudo make install', 'sudo make package'. The .deb package is made in the 'build' folder.

{{:opencpn:dev:oplaydo:package_1.png?nolink&}}

- Open the .deb file from 'build' in the 'Ubuntu Software Centre'.

{{:opencpn:dev:oplaydo:software_centre.png?nolink&}}

- A warning

{{:opencpn:dev:oplaydo:software_centre_warning.png?nolink&}}

- Carry on!

{{:opencpn:dev:oplaydo:software_centre_2.png?nolink&}}

{{:opencpn:dev:oplaydo:software_centre_3.png?nolink&}}

- The plugin libDR_pi.so has been installed in '/usr/lib/opencpn'.

- When you enable the DR plugin you should see the plugin icon on the toolbar.

{{:opencpn:dev:oplaydo:p_on_toolbar.png?nolink&}}

{{:opencpn:dev:oplaydo:p_working.png?nolink&}}

===== Notes =====

**The next guide will show the DR_pi plugin being renamed as 'oplaydo1_pi' and modified. **

**'oplaydo1_pi' will allow the user to input start and finish positions. From these positions a GPX file will be created that can be imported and viewed in OpenCPN. **

